import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-11-08
 * Time: 11:01
 */
public class test_1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int t = in.nextInt();
            while (t-- > 0) {
                int person_hp = in.nextInt();
                int person_akt = in.nextInt();
                int monster_hp = in.nextInt();
                int monster_akt = in.nextInt();
                if (person_akt >= monster_hp) {
                    System.out.println(-1);
                } else {
                    int num = 0;
                    int monster = monster_hp;
                    while (true) {
                        //玩家攻击
                        monster -= person_akt;
                        if (monster <= 0) {
                            num++;
                            monster = monster_hp;
                            continue;
                        }
                        //怪物攻击
                        person_hp -= monster_akt;
                        if (person_hp <= 0) {
                            break;
                        }
                    }
                    System.out.println(num);
                }
            }
        }
    }
}
